﻿using System.Collections.Generic;
using System.Linq;
using Epam.PeopleInterfaces;
using JsonModel;

namespace Epam.BusinessLogic
{
    public class NewsJsonService:INewsJsonService
    {
        public IEnumerable<INewsJsonAdapter> Convert(IEnumerable<INewsEntity> entities)
        {
            return from newsEntity in entities
                   select
                       new NewsJsonAdapter(newsEntity.Id, newsEntity.Title, newsEntity.Text,
                                           newsEntity.Created.ToShortDateString());

        }
    }
}
